package xyz.migle.sc.demo;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@EnableDiscoveryClient
@RestController

@Configurable
@EnableAutoConfiguration

//@EnableConfigurationProperties({ConfigDemo.class})  //通过EnabledConfigurationProperties注解取值(启动项目后修改consul上的属性值，项目中的属性值立即发生变化)
public class ScBase001 {

//    @Value("${test-value}") //通过@value注解的值,应用启动后再修改consul中的值，应用中的值是不会刷新的，刷新事件会接收到但值是不会再变的,值在consul中不存在时会报错，不能正常启动
//    String test_value;
//
//    @Autowired
//    private ConfigDemo configDemo;
//
//    @RequestMapping("/")
//    public String home() {
//        System.out.println("Hello World,i am sc-base-001,${user} is :" + test_value);
//        return "Hello World,i am sc-base-001,test_value is :" + test_value + " password:" + configDemo.getPassword();
//    }
    public static void main(String[] args) {
        SpringApplication.run(ScBase001.class, args);
    }

}
